<template>
  <div>
    <Child1 />
    <hr />
    <Child2 v-if="show" />
    <button @click="handClick">切换Child2的展示</button>
  </div>
</template>
<!-- 
<script>
import Child1 from './Child1.vue'
import Child2 from './Child2.vue'
export default {
  name: 'EventBus',
  data() {
    return {
      show: true
    }
  },
  components: {
    Child1,
    Child2
  },
  methods: {
    handClick() {
      this.show = !this.show
    }
  }
}
</script> -->
<script setup>
import { ref } from 'vue'
import Child1 from './Child1.vue'
import Child2 from './Child2.vue'

const show = ref(true)
const handClick = () => {
  show.value = !show.value
}
</script>
